package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("deviceList")
public class DeviceList extends EntityQuery<Device> {

	private static final String EJBQL = "select device from Device device";

	private static final String[] RESTRICTIONS = {
			"lower(device.name) like lower(concat(#{deviceList.device.name},'%'))",
			"lower(device.type) like lower(concat(#{deviceList.device.type},'%'))", };

	private Device device = new Device();

	public DeviceList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Device getDevice() {
		return device;
	}
}
